//
//  TSRuntime.m
//  Picture
//
//  Created by 王磊 on 04/05/2017.
//  Copyright © 2017 ThreeStone. All rights reserved.
//

#import "TSRuntimeManager.h"

#import <objc/message.h>

// 利用消息机制 发送消息

#define TSMsgSend(...) ((void (*)(void *, SEL,id))objc_msgSend)(__VA_ARGS__)

// 把任意类型转的对象转换为指针

#define TSMsgTargetConvert(target) (__bridge void *)(target)

static TSRuntimeManager *manager = nil;
@implementation TSRuntimeManager
+ (instancetype)getInstance {
    
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        
        manager = [TSRuntimeManager new];
        
    });
    return manager;
}
- (void)addTarget:(id)target andSel:(SEL)sel andAnyArgu:(id)any {
    
    TSMsgSend(TSMsgTargetConvert(target), sel,any);
    
}

@end
